﻿//Write a program that finds the most frequent number in an array. Example:
//{4, 1, 1, 4, 2, 3, 4, 4, 1, 2, 4, 9, 3} -> 4(5 times)


using System;

class MostFrequentNumber
{
    static void Main()
    {
        int numberN = int.Parse(Console.ReadLine());
        int[] arrayN = new int[numberN];

        for (int i = 0; i < arrayN.Length; i++)
        {
            arrayN[i] = int.Parse(Console.ReadLine());
        }

        int indexArray = 0;
        int counter = 1;
        int maxCounter = 1;
        for (int i = 0; i < arrayN.Length - 1; i++)
        {
            for (int j = i + 1; j < arrayN.Length; j++)
            {
                if (arrayN[i] == arrayN[j])
                {
                    counter++;
                }
            }
            if (counter > maxCounter)
            {
                maxCounter = counter;
                indexArray = i;
            }
            counter = 1;
        }
        Console.WriteLine("{0} ({1} times)", arrayN[indexArray], maxCounter);
    }
}
